<?php
/* [$WindsForce] (C)Hunzhiwange.COM Since 2012.03.17.
   群组首页控制器($$)*/

!defined('Q_PATH') && exit;

class PublicController extends InitController{

	public function index(){
		if($GLOBALS['_cache_']['group_option']['newtopic_default']==1){
			$this->_arrSeo['title']=Q::L('新帖','Controller');
			$this->child('Public@Newtopic','index');
		}else{
			$this->_arrSeo['title']=Q::L('小组','Controller');
			$this->child('Public@Index','index');
		}
	}

	public function newtopic(){
		if($GLOBALS['_cache_']['group_option']['newtopic_default']==1){
			$this->_arrSeo['title']=Q::L('小组','Controller');
			$this->child('Public@Index','index');
		}else{
			$this->_arrSeo['title']=Q::L('新帖','Controller');
			$this->child('Public@Newtopic','index');
		}
	}

	public function getSeo($oChild){
		if(CITY_ON===TRUE && $GLOBALS['_commonConfig_']['DEFAULT_APP']=='group' && ACTION_NAME==='index'){
			$oChild->_arrSeo=Core_Extend::getSeocity($GLOBALS['_citysite_']);
		}else{
			Core_Extend::getSeo($oChild,array('title'=>$this->_arrSeo['title']),true,false,true);
		}
	}

	public function getOption_(){
		$arrGroupOption=array();
		
		if(Core_Extend::isCitysite()){
			$arrTempTotal=json_decode($GLOBALS['_cache_']['group_option']['group_totaltodaynum_city'],true);
			$arrTempTopic=json_decode($GLOBALS['_cache_']['group_option']['group_topictodaynum_city'],true);
			$arrTempComment=json_decode($GLOBALS['_cache_']['group_option']['group_topiccommenttodaynum_city'],true);

			$arrGroupOption=array(
				isset($arrTempTotal[$GLOBALS['_citysite_']['site_domain']])?$arrTempTotal[$GLOBALS['_citysite_']['site_domain']]:0,
				isset($arrTempTopic[$GLOBALS['_citysite_']['site_domain']])?$arrTempTopic[$GLOBALS['_citysite_']['site_domain']]:0,
				isset($arrTempComment[$GLOBALS['_citysite_']['site_domain']])?$arrTempComment[$GLOBALS['_citysite_']['site_domain']]:0
			);
		}else{
			$arrGroupOption=array(
				$GLOBALS['_cache_']['group_option']['group_totaltodaynum'],
				$GLOBALS['_cache_']['group_option']['group_topictodaynum'],
				$GLOBALS['_cache_']['group_option']['group_topiccommenttodaynum']
			);
		}

		$this->assign('arrGroupOption',$arrGroupOption);
	}

}
